// components/ticketsNotes/ticketsNotest.js
const app = getApp();
const cloudUrl = app.globalData.cloudUrl;

Component({

  /**
   * 组件的属性列表
   */
  properties: {
    isTipsShow:{ // 是否显示 控制开关
      type: Boolean,
      value: false
    },
    info:{ // 门票信息
      type: Object,
      value: {}
    },
    info:String,
    swipers:{ // 门票信息
      type: Array,
      value: []
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    cloudUrl:cloudUrl,
    //幻灯片
    indicatorDots: true,
    vertical: false,
    autoplay: true,
    circular: false,
    interval: 2000,
    duration: 500,
    previousMargin: 0,
    nextMargin: 0,
    swiperUrls:["ms/1.jpg",cloudUrl+"ms/2.jpg"],
    curInfo:{}
  },
  ready: function() { 
   
  },
  attached: function() { 
    try{
      //console.log("attachedattachedattached");
      const obj = JSON.parse(this.data.info);
      this.setData({curInfo:obj,swiperUrls:obj.swipers});
    }
    catch(e){
      console.log("报错attachedattached"+e);
    }
   
  },
  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show: function () { 
      // try{
      //   const obj = JSON.parse(this.data.info);
  
      //   console.log("来得深刻四点零四--->");
      //   console.log(obj.swipers);
      //   this.setData({curInfo:obj,swiperUrls:obj.swipers});
      // }
      // catch(e){
  
      //   console.log("=====报错波士顿肯定是");
      // }

    },
    hide: function () { },
    resize: function () { },
  },
  /**
   * 组件的方法列表
   */
  methods: {
    onTipsViewClick(e){
      //console.log(this.data.info);
      this.setData({isTipsShow:false});
      var myEventDetail = {type:"close"} // detail对象，提供给事件监听函数
      var myEventOption = {} // 触发事件的选项
      this.triggerEvent('myevent', myEventDetail, myEventOption)
    }
    
  }
})